package organizer.hb;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import org.hibernate.annotations.Index;
import org.hibernate.annotations.Table;
import organizer.IFileMetadata;

/**
 *
 * @author dawong
 */
@Entity
@Table(appliesTo="FileMetadataEntity", 
        indexes={@Index(name="sort",columnNames={"sortNumber"}),
        @Index(name="len",columnNames={"length"}),
        @Index(name="hash",columnNames={"contentHash"})})
public class FileMetadataEntity implements IFileMetadata {
    
    private String path;
    private String contentHash;
    private Long sortNumber;
    private long length;
    private long modifiedDate;

    public FileMetadataEntity() {
    }

    public FileMetadataEntity(IFileMetadata orig) {
        this.path = orig.getPath();
        this.contentHash = orig.getContentHash();
        this.length = orig.getLength();
        this.modifiedDate = orig.getModifiedDate();
    }
    
    @Id
    @Column(length=1024)
    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getContentHash() {
        return contentHash;
    }

    public void setContentHash(String contentHash) {
        this.contentHash = contentHash;
    }

    public Long getSortNumber() {
        return sortNumber;
    }

    public void setSortNumber(Long sortNumber) {
        this.sortNumber = sortNumber;
    }

    public long getModifiedDate() {
        return modifiedDate;
    }

    public void setModifiedDate(long modifiedDate) {
        this.modifiedDate = modifiedDate;
    }

    public long getLength() {
        return length;
    }

    public void setLength(Long length) {
        this.length = length;
    }

}
